﻿<script>
$(function(){
	$(".check-all").click(function(){
		$(".check-owner,.check-all").attr("checked", this.checked);
	});
	
	$(".delete-btn").click(function(){
		if (confirm("确定删除吗？")) {
			document.getElementById('form1').action = '<?=$this->createUrl('/admin/owner/delete')?>';
		} else {
			return false;
		}
	});

	$(".box-btn").click(function(){
		window.open(this.href, "_blank", "width=1000,height=700,scrollbars=yes");
		return false;
	})
});
</script>


<div class="block list-form">
	<div class="block-title"><?=$block_title?></div>
	
	<form method="post">
		<?php $this->widget('zii.widgets.grid.CGridView', array(
			'id'=>'adv-grid',
			'dataProvider'=>$dataProvider,
			'columns'=>array(
				array(
					'type' => 'raw',
					'name' => "Select",
					'value' => 'CHtml::checkbox("owners[]", null, array("value" => $data->owner_id))',
				),
				array('type' => 'raw', 'name' => '账号', 'value' => '"<a class=\'box-btn\' href=\'/index.php/admin/owner/edit?owner_id={$data->loginid}\'>$data->loginid</a>"'),
				array('name' => '邮箱', 'value' => '$data->email'),
				array('name' => '网站', 'value' => '$data->site'),
				array('name' => '电话', 'value' => '$data->telephone'),
				array('name' => '位置', 'value' => '$data->country."-".$data->state."-".$data->city'),
				array('name' => '状态', 'value' => '$data->inuse==0? "不可用" : "<span style=\'color:green\'>可用</span>"', 'type' => 'raw'),
			),
			
		)); ?>
		
		
		<div class="op-list">
			<input type="submit" class="op-btn" action="<?php echo $this->createUrl('owner/update', array('inuse' => '1'))?>" value="开通" />
			<input type="submit" class="op-btn" action="<?php echo $this->createUrl('owner/update', array('inuse' => '0'))?>" value="停用" />
		</div>
		
		<script>
		$(function(){
			$(".op-btn").click(function(){
				$(this).parents('form:first').attr('action', $(this).attr('action')).submit();
			});
		});
		</script>
	</form>
</div>